package com.csk.zsk.compents.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.csk.zsk.commons.dao.impl.BaseHibernateDao;
import com.csk.zsk.compents.dao.PlaylistDao;
import com.csk.zsk.compents.entity.Playlist;

@Repository
public class PlaylistDaoImpl extends BaseHibernateDao<Playlist, String> implements PlaylistDao {

	@Override
	public Playlist getLovePlaylistByUserId(String userId) {
		return (Playlist) createQuery("from Playlist pl where pl.userId = ? and pl.name = '我的最爱' and pl.isSys = true", userId).uniqueResult();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Playlist> getPlaylistByUserId(String userId) {
		return createQuery("from Playlist pl where pl.userId = ?", userId).list();
	}

}
